home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 43.zip
/
Sources C- WorkDisk V.adf
/
image
/
imagebs1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1987-02-15
|
4KB
|
180 lines
#include "exec/types.h"
#include "intuition/intuition.h"
struct IntuitionBase *IntuitionBase;
struct Window *NoBorder;
struct GfxBase *GfxBase;
struct IntuiMessage *mesg;
struct RastPort *r;
struct ViewPort *vp;
struct Screen *Scrn;
USHORT bs1smallData[] =
{
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x7CF0,0x3E70,0x0000,0xE61F,0xE73D,0xFC00,
0x7CF8,0xFF30,0x0001,0xE79F,0xF33C,0x1C00,
0x7CFC,0xFF90,0x0003,0xE78F,0xF93C,0x3000,
0x7CF0,0x7FC0,0x0003,0xE787,0xFC3D,0xF000,
0x7CF8,0x3FE0,0x0003,0xE793,0xFE3C,0x7000,
0x7CFC,0x9FF0,0x0001,0xE799,0xFF3C,0x0C00,
0x7CF8,0xCFE0,0x0000,0xE71C,0xFF3C,0x7C00,
0x0000,0x0000,0x0000,0x0000,0x0000,0x01E1
};
struct Image bs1small =
{
0,0, /* LeftEdge, TopEdge */
87,9,1, /* Width, Height, Depth */
&bs1smallData[0],
1,0, /* PlanePick, PlaneOnOff */
NULL /* Pointer to next Image */
};
#define INTUITION_REV 0
#define GRAPHICS_REV 0
main()
{
ULONG flags,mclass;
SHORT x,y,w,h,d;
USHORT mode;
UBYTE *name,c0,c1;
VOID OpenALL();
double ran(), rannr;
OpenALL();
/* ======Open een lores custom screen====== */
y=0;
w=320;
h=200;
d=5; /* max 32 colors ! */
c0=0x00;
c1=0x01;
mode=NULL;
Scrn=(struct Screen *)
make_screen(y,w,h,d,c0,c1,mode,NULL);
/* ======open een borderless window ====== */
x=y=0;
w=320;
h=200;
flags=ACTIVATE|NOCAREREFRESH|BORDERLESS|GIMMEZEROZERO;
NoBorder=(struct Window *)
make_window(x,y,w,h,NULL,flags,Scrn);
/* ======geen screentitel====== */
ClearMenuStrip(NoBorder);
r=NoBorder->RPort;
vp=ViewPortAddress(NoBorder);
for(x=0;x<32;x++) SetRGB4(r,x,x%16,x%16,(15-x)%16);
for(;;)
{
DrawImage(r,&bs1small,(LONG) ( (rannr=ran() ) * (320.0-87.0) ), (LONG) ( (rannr=ran() ) * (199.0-9.0) ) );
if( (mesg=(struct IntuiMessage *) GetMsg(NoBorder->UserPort)) != NULL)
{
ReplyMsg(mesg);
break;
}
}
while( (mesg=(struct IntuiMessage *) GetMsg(NoBorder->UserPort)) != NULL)
ReplyMsg(mesg);
CloseWindow(NoBorder);
CloseScreen(Scrn);
CloseLibrary(GfxBase);
}
/*========================================================================*/
VOID OpenALL()
{
/* ======open Intuition====== */
IntuitionBase=(struct IntuitionBase *)
OpenLibrary("intuition.library",INTUITION_REV);
if(IntuitionBase==NULL)
exit(FALSE);
/* ======open the Graphics Library====== */
GfxBase=(struct GfxBase *)
OpenLibrary("graphics.library",GRAPHICS_REV);
if(GfxBase==NULL)
exit(FALSE);
}
make_window(x,y,w,h,name,flags,screen)
SHORT x,y,w,h;
UBYTE *name;
ULONG flags;
struct Screen *screen;
{
struct NewWindow NewWindow;
NewWindow.LeftEdge = x;
NewWindow.TopEdge = y;
NewWindow.Width = w;
NewWindow.Height = h;
NewWindow.DetailPen = -1;
NewWindow.BlockPen = -1;
NewWindow.Title = name;
NewWindow.Flags = flags;
NewWindow.IDCMPFlags = MOUSEBUTTONS;
NewWindow.Type = CUSTOMSCREEN;
NewWindow.FirstGadget = NULL;
NewWindow.CheckMark = NULL;
NewWindow.Screen = screen;
NewWindow.BitMap = NULL;
NewWindow.MinWidth = 0;
NewWindow.MinHeight = 0;
NewWindow.MaxWidth = 0;
NewWindow.MaxHeight = 0;
return(OpenWindow(&NewWindow));
}
make_screen(y,w,h,d,color0,color1,mode,name)
SHORT y,w,h,d;
UBYTE color0,color1,*name;
USHORT mode;
{
struct NewScreen NewScreen;
NewScreen.LeftEdge = 0;
NewScreen.TopEdge = y;
NewScreen.Width = w;
NewScreen.Height = h;
NewScreen.Depth = d;
NewScreen.DetailPen = color0;
NewScreen.BlockPen = color1;
NewScreen.ViewModes = mode;
NewScreen.Type = CUSTOMSCREEN;
NewScreen.Font = NULL;
NewScreen.DefaultTitle = name;
NewScreen.Gadgets = NULL;
NewScreen.CustomBitMap = NULL;
return(OpenScreen(&NewScreen));
}